package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.sql.DataSource;


/**
 * @Author 王加鑫
 * @Date 2021/7/22 20:49
 * @Since JDK 1.9
 */
@Service
public class BookServiceImpl implements BookService {

/*    @Resource
    private BookDao dao;*/

    @Value("10")
    int num1;
    @Value("20")
    int num2;

    @Autowired
    @Qualifier("bookDaoImpl2")
    private BookDao dao2;

    @Override
    public void save() {
/*        dao.save();*/
        dao2.save();
        System.out.println("BookServiceImpl save ...");

    }

    @Override
    public void getSum(){
        System.out.println(num1 + num2);
    }

    @Override
    public void getDataSource(DataSource dataSource) {
        System.out.println(dataSource);
    }
}
